package com.czl.elm.service.impl;

import com.czl.elm.dao.impl.FoodMapperImpl;
import com.czl.elm.domain.Food;
import com.czl.elm.domain.FoodMenu;
import com.czl.elm.service.IFoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zuoleiChen
 * @since 2021-05-23
 */
@Service
public class FoodServiceImpl  implements IFoodService {

    @Autowired
    private FoodMapperImpl foodMapper;

    /**
     * 测试专用，添加食物
     * @param food
     */
    @Override
    public void addFood(Food food) {
        food.setFoodid("food"+food.getShopid()+"_"+System.currentTimeMillis());

        foodMapper.addFood(food);
    }

    /**
     * 添加商店的菜单卡
     * @param foodMenu
     */
    @Override
    public void addShopMenu(FoodMenu foodMenu) {
        foodMapper.addMenu(foodMenu);
    }

    /**
     * 获取food的规格
     * @param foodid
     * @return
     */
    @Override
    public Map<String, Integer> selectSpecifications(String foodid) {
        return foodMapper.selectSpecifications(foodid);
    }

    @Override
    public void t_addShopSpecifications(Map<String, Object> map) {
        foodMapper.t_addShopSpecifications(map);
    }
}
